"""
@title(TenX腾晓2024年11月考核答题文件)
@warning(请勿修改参数和返回值)
@warning(请认真填写__init__中的数据)
@author(1323230180)
"""
from typing import List, Tuple


class TenXClass:
    def __init__(self):
        self.name = "黄鹏"
        self.id = "3124002413"

    @staticmethod
    def question1(n: int) -> list[str]:
        Save_strs = []
        for i in range(1, n + 1):
            num = []
            while i != 0:
                num.append(str(i % 4))
                i = i // 4
            Connect_str = ''.join(num[::-1])
            Save_strs.append(Connect_str)
        return Save_strs

    @staticmethod
    def question2() -> list[tuple[int, int, int]]:
        Big_list = []
        for z in range(1, 34):
            Small_list = []
            x = 4 * z - 100
            y = -7 * z + 200
            if 100 >= x >= 0 and 100 >= y >= 0:
                Small_list.append(x)
                Small_list.append(y)
                Small_list.append(z * 3)
                One_tuple = tuple(Small_list)
                Big_list.append(One_tuple)
        return Big_list

    @staticmethod
    def question3(equipment: list[str], prop: list[str], material: list[str], items: list[str]) -> dict[str, list[str]]:

        Res_dict = {
            "equipment": [],
            "prop": [],
            "material": []
        }

        for item in items:
            if item in equipment:
                Res_dict["equipment"].append(item)
            elif item in prop:
                Res_dict["prop"].append(item)
            elif item in material:
                Res_dict["material"].append(item)

        return Res_dict

    @staticmethod
    def question4(item_values: dict[str, int], items: list[str]) -> tuple[list[str], int]:
        Count_val = []
        Count_key = []
        Result = []

        def Find_key(a, value):
            for b, c in a.items():
                if c == value:
                    return b

        for item in items:
            Count_val.append(item_values[item])

        Count_val = sorted(Count_val, reverse=True)
        Count_max = Count_val[0] + Count_val[1] + Count_val[2]

        for i in range(0, 3):
            Count_key.append(Find_key(item_values, Count_val[i]))

        Result = [Count_key, Count_max]

        return tuple(Result)

    @staticmethod
    def question5(matrix: list[list[int]]) -> list[tuple[int, int]]:
        Record = []
        Result = []

        for Row in range(0, len(matrix)):
            for Column in range(0, len(matrix[0])):
                if matrix[Row][Column] == 0:
                    Row0 = Row + 1
                    Column0 = Column + 1
                    Record = [Row0, Column0]
                    Result.append(tuple(Record))

        return Result
